home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / ENDWIN.C < prev    next >
Text File  |  1992-11-21  |  3KB  |  85 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3. #undef endwin
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid_endwin = "$Header: c:/curses/portable/RCS/endwin.c%v 2.0 1992/11/15 03:28:46 MH Rel $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   endwin()     - restore initial terminal environment
  15.  
  16.   X/Open Description:
  17.        A program should always call endwin() before exiting or
  18.        escaping from curses mode temporarily.  This routine will
  19.        restore tty modes, move the cursor to the lower left corner
  20.        of the screen and reset the terminal into the proper non-visual
  21.        mode.  To resume curses after a temporary escape, refresh() or
  22.        doupdate() should be called.
  23.  
  24.   PDCurses Description:
  25.        At this time, endwin() must be followed by a call to initscr()
  26.        for temporary escapes.
  27.  
  28.        In addition, endwin() will resize the screen, if necessary.
  29.  
  30.   X/Open Return Value:
  31.        The endwin() function returns OK on success and ERR on error.
  32.  
  33.   X/Open Errors:
  34.        No errors are defined for this function.
  35.  
  36.   Portability:
  37.        PDCurses        int endwin( void );
  38.        X/Open Dec '88  int endwin( void );
  39.        BSD Curses      
  40.        SYS V Curses    
  41.  
  42. **man-end**********************************************************************/
  43.  
  44. int    endwin(void)
  45. {
  46.        PDC_scr_close();
  47. /*     resetty();*/
  48.        if (_cursvar.orig_font != _cursvar.font)  /* screen has not been resized */
  49.                {
  50.                PDC_set_font(_cursvar.orig_font);
  51.                resize(PDC_get_rows());
  52.                }
  53.  
  54.        _cursvar.visible_cursor = FALSE;        /* Force the visible cursor */
  55.        _cursvar.cursor = _cursvar.orig_cursor;
  56.        curson();
  57. #if 0
  58.        _cursvar.blank = ' ';            /* Reset blank char to a space */
  59.        wmove(stdscr, 0, 0);             /* Ensure full window clear    */
  60.        wclrtobot(stdscr);
  61.        wrefresh(stdscr);
  62. #endif
  63.  
  64.        delwin(stdscr);
  65.        delwin(curscr);
  66.        delwin(tmpwin);
  67.        stdscr = (WINDOW *)NULL;
  68.        curscr = (WINDOW *)NULL;
  69.        tmpwin = (WINDOW *)NULL;
  70.        _cursvar.alive = FALSE;
  71.  
  72.        /*
  73.         * Position cursor so that the screen will not scroll until they hit
  74.         * a carriage return.
  75.         */
  76.        PDC_gotoxy(PDC_get_rows() - 2, 0);
  77. #ifdef FLEXOS
  78.        _flexos_8bitmode();
  79. #endif
  80. /*     PDC_fix_cursor(_cursvar.orig_emulation);*/
  81.        if (_cursvar.orig_font != _cursvar.font)  /* screen has not been resized */
  82.                reset_shell_mode();
  83.        return( OK );
  84. }
  85.